package com.youchuang.helper;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@SuppressWarnings("rawtypes")
public interface HibernateHelper<T> {

    Session getCurrentSession();

    SessionFactory getSessionFactory();

    String save(T o);

    void update(T o);

    void saveOrUpdate(T o);

    void merge(T o);

    void delete(T o);

    T get(Class<T> c, Serializable id);

    T get(String hql, List<Object> param);

    Long count(String hql, List<Object> param);

    List<T> find(String hql, List<Object> param);

    List<T> find(String hql, int page, int rows, List<Object> param);

    Integer executeHql(String hql, List<Object> param);

    Criteria getCriteria(Class<T> c, Map<String, Object> param);

    List<Object[]> findBySQL(String sql);

    List<Object[]> fildBySQL(String sql, List<Object> param);

    List<Object[]> findBySql(String sql, int page, int rows, List<Object> param);

    Long countBySql(String sql, List<Object> param);

    Integer executeSql(String sql, List<Object> param);

}